<template>
	<view>
		<wx-open-launch-app id="launch-btn" appid="wxdb8b21091717ff69" :extinfo="JSON.stringify(extinfo)">

			<script type="text/wxtag-template">
				<style>
							.btn{  
								background: linear-gradient(270deg, rgb(174, 137, 85), rgb(205, 164, 111));  
								border: 0;  
								color: #FFFFFF;  
								border-radius: 50px;  
								text-align: center;  
								width: 285px;  
								height: 40px;  
								line-height: 40px;  
								outline:none;  
							}  
							</style> 
							<button class="btn" open-type="agreePrivacyAuthorization">App内查看</button>
						</script>
		</wx-open-launch-app>

	</view>

</template>


<script>
	import wx from 'weixin-js-sdk';
	const app = getApp();
	import Vue from 'vue'
	import {
		getConfigParam1
	} from '@/api/home.js';
	export default {
		components: {

		},
		data() {
			return {
				wxOpenTag: '',
				extinfo: {
					'llname': 'ppp',
					'llid': '123456789'
				},
				wxAppId: 'wxdb8b21091717ff69'
			}
		},
		mounted: function() {
			let that = this;
			that.initWxSDK();
			console.log(that.extinfo)
			console.log(JSON.stringify(that.extinfo))
		},
		methods: {
			initWxSDK() {
				let that = this;
				getConfigParam1().then(res => {
					//console.log(res.timestamp)
					//console.log(res.nonceStr)
					//console.log(res.signature)
					wx.config({
						debug: false,
						appId: 'wx92b0e22e2be1ea76',
						timestamp: res.timestamp,
						nonceStr: res.nonceStr,
						signature: res.signature,
						jsApiList: ['onNeedPrivacyAuthorization'],
						openTagList: ['wx-open-launch-app'] // 关键！
					});
					wx.ready((res) => {
						//console.log('成功--------' + JSON.stringify(res));
					});

					wx.error(res => {
						//console.log('失败---------' + JSON.stringify(res));
					});
				})

			},
		}
	}
</script>

<style lang="scss" scoped>
</style>